//
//  NSDictionary+CC_net.m
//  ocCrazy
//
//  Created by mac on 2018/8/6.
//  Copyright © 2018年 dukai. All rights reserved.
//

#import "NSDictionary+CC_net.h"
#import "API.h"
#import "Tool.h"
#define CC_SUCCESS [self[@"code"] integerValue] == 200

@implementation NSDictionary (CC_net)

- (void)success:(void(^)())success faild:(void(^)())faild{
    if (CC_SUCCESS) {
        if (success) success();
    }else{
        [Tool showAlert:self[@"message"]];
        if (faild) faild();
    }
}

- (void)success:(void(^)())success{
    [self success:success faild:nil];
}


@end
